package com.jun.flower.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jun.flower.bean.TbOrdrsitem;
import com.jun.flower.bean.TbOrdrsitemExample;
import com.jun.flower.bean.TbOrdrsitemExample.Criteria;
import com.jun.flower.dao.TbOrdrsitemMapper;
import com.jun.flower.service.OrderitemService;
@Service
public class OrderitemServiceImpl implements OrderitemService {

	@Autowired
	private TbOrdrsitemMapper  ordrsitemMapper;
	@Override
	public List<TbOrdrsitem> getOrderitemByOrdersId(Integer ordersId) {
		//根据订单ID查询订单关联表数据
		TbOrdrsitemExample example = new TbOrdrsitemExample();
		Criteria criteria = example.createCriteria();
		criteria.andOrdersIdEqualTo(ordersId);
		List<TbOrdrsitem> list = ordrsitemMapper.selectByExample(example);
		return list;
	}
	@Override
	public void deleteOrderitem(Integer flowersId) {
		TbOrdrsitemExample example = new TbOrdrsitemExample();
		Criteria criteria = example.createCriteria();
		criteria.andFlowersIdEqualTo(flowersId);
		ordrsitemMapper.deleteByExample(example);
	}
	@Override
	public void addOrderitem(TbOrdrsitem ordersitem) {
		ordrsitemMapper.insert(ordersitem);
	}
	@Override
	public void deleteOrderitemByordersId(Integer ordersId) {
		TbOrdrsitemExample example = new TbOrdrsitemExample();
		Criteria criteria = example.createCriteria();
		criteria.andOrdersIdEqualTo(ordersId);
		ordrsitemMapper.deleteByExample(example);
		
	}

}
